"""add review fields to orders

Revision ID: xxx
Revises: previous_revision_id
Create Date: 2024-03-27 23:30:00

"""
from alembic import op
import sqlalchemy as sa

# revision identifiers, used by Alembic.
revision = 'xxx'  # 这里会自动生成
down_revision = 'previous_revision_id'  # 需要替换为你的上一个迁移版本ID
branch_labels = None
depends_on = None

def upgrade():
    # 添加评价相关字段
    op.add_column('orders', sa.Column('rating', sa.Integer(), nullable=True))
    op.add_column('orders', sa.Column('comment', sa.String(500), nullable=True))
    op.add_column('orders', sa.Column('commented_at', sa.DateTime(timezone=True), nullable=True))

def downgrade():
    # 删除评价相关字段
    op.drop_column('orders', 'rating')
    op.drop_column('orders', 'comment')
    op.drop_column('orders', 'commented_at') 